/*

import application.*;
import link.*;
import network.*;
import transport.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;

public class Main {

    static Timer neighbourCheck;
    final static long TIMEOUTNEIGHBOURS = 10000;
    public static String myID;
    public static Neighbours neighbours;
    public static BellmanFord bellman;
    public static UserInterface userInterface;
    public static Router router;
    public static SNACASD sd;
    public static PhysicalLayer pl;
    
    public static void handleMessage(String msg) {
        String[] splitMessage = msg.split(":");
        if (splitMessage[0].equalsIgnoreCase("ALL") || splitMessage[0].equals(myID)) {
            //System.out.println(splitMessage[2]);
            if (splitMessage[2].equalsIgnoreCase("DISCOVER")) {
                sd.handleDiscover();
            } else if (splitMessage[2].equalsIgnoreCase("SERVICES")) {
                sd.handleServices(msg);
            } else if (splitMessage[2].equalsIgnoreCase("VECTOR")) {
                System.out.println(msg);
            	bellman.handleVector(msg);
            } else if (splitMessage[2].equalsIgnoreCase("HELLO")) {
            	neighbours.updateTable(splitMessage[1]);
            } else if (splitMessage[2].equalsIgnoreCase("NXTHOP")) {
                router.processNXTHOP(msg);
            } else if (splitMessage[2].equalsIgnoreCase("ACK")) {
                // Implement ACK
            } else if (splitMessage[2].equalsIgnoreCase("NACK")) {
                // Implement NACK
            } else if (splitMessage[2].equalsIgnoreCase("MESSAGE")) {
                pl.send(myID + ":" + splitMessage[1] + ":ACK:" + splitMessage[3]);
                String msgOut = "";
                for (int i = 4; i < splitMessage.length; i++) {
                    msgOut = msgOut + splitMessage[i] + ":";
                }
                handleMessage(msgOut);
            }
        }
    }

    public static void main(String[] args) throws InterruptedException,
            UnknownHostException {
        // the "main loop" of your networked application
        //
        pl = new PhysicalLayer("volvo"); // initiate a physical layer
        neighbours = new Neighbours();
        bellman = new BellmanFord(pl);
        router = new Router(pl);
        sd = new SNACASD(pl, 10, 3); // initiate a name service discovery module
        //myID = sd.getUniqueName(args[0]);
        myID = sd.getUniqueName("Roger");
        sd.myName = myID;
        System.out.println("Name " + myID + " accepted.");
        // retrieve the name of your computer
        String localname = InetAddress.getLocalHost().getHostName();
        // tell it to the main hub
        pl.send("server:" + myID + ":serverjoin:" + localname);
        // Do some more initialization
        NeighbourTask neighbourTask = new NeighbourTask(neighbours);
        neighbourCheck = new Timer();
        neighbourCheck.schedule(neighbourTask, TIMEOUTNEIGHBOURS, TIMEOUTNEIGHBOURS);

        userInterface = new UserInterface();
        //userInterface.run();

        String msg = null;
        while (true) {
            // Process incoming messages
            msg = pl.receive();
            if (msg != null) {
                handleMessage(msg);
                // Sleep for milliseconds
                Thread.sleep(10);
            }
        }
    }
}

class NeighbourTask extends TimerTask {

    Neighbours neighbour;

    public NeighbourTask(Neighbours neighbour) {
        this.neighbour = neighbour;
    }

    public void run() {
        neighbour.checkTimeouts();
    }
}
*/